package org.abettor.pushbox.util;

import java.lang.reflect.Field;

/**
 * 资源工具类
 * @author shawn
 *
 */
public abstract class Resource
{
	/**
	 * 获取指定关卡的地图资源ID
	 * @param mission 关卡编号
	 * @return 成功返回资源ID的值，否则返回0
	 */
	public static int getMapResourceByMission(int mission)
	{
		try
		{
			Class<?> clazz = Class.forName("org.abettor.pushbox.R$raw");
			Field field = clazz.getField("mission" + mission);
			Integer val = (Integer) field.get(null);
			return val.intValue();
		}
		catch(Exception e)
		{
			return 0;
		}
	}
}
